module.exports = {
  description: 'generate a option',
  prompts: [
    {
      type: 'input',
      name: 'name',
      message: '组件名称(英文): ',
      validate(value) {
        if (!value || value.trim === '') {
          return 'name is required';
        }
        return true;
      },
    },
  ],
  actions: (data) => {
    const dir = `${process.cwd()}/src/views/workFlow/src/CustomForm/options/${data.name}Option.vue`;
    const actions = [
      {
        type: 'add',
        path: dir,
        templateFile: './option/index-ts.hbs',
        data: {
          name: data.name,
        },
      },
    ];
    return actions;
  },
};
